const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('rquser', {
    userid: {
      type: DataTypes.INTEGER,
      allowNull: false,
      primaryKey: true,
      autoIncrement: true,
    },
    loginname: {
      type: DataTypes.STRING(45),
      allowNull: true
    },
    loginpwd: {
      type: DataTypes.STRING(45),
      allowNull: true
    },
    wxopenid: {
      type: DataTypes.STRING(45),
      allowNull: true
    },
    phone: {
      type: DataTypes.STRING(45),
      allowNull: true
    },
    nickname: {
      type: DataTypes.STRING(45),
      allowNull: true
    },
    regtime: {
      type: DataTypes.DATE,
      allowNull: true
    },
    lastlogin: {
      type: DataTypes.DATE,
      allowNull: true
    },
    headicon: {
      type: DataTypes.STRING(400),
      allowNull: true
    }
  }, {
    sequelize,
    tableName: 'rquser',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "userid" },
        ]
      },
    ]
  });
};
